﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CSDemo.Common;
using Hik.Communication.Scs.Communication.EndPoints.Tcp;
using Hik.Communication.ScsServices.Service;

namespace CSDemo.SCS.Server
{
    class Program
    {
        static void Main(string[] args)
        {
            var server = ScsServiceBuilder.CreateService(new ScsTcpEndPoint(10048));

            server.AddService<IProductService,
                       ScsProductService>(new ScsProductService());
            server.ClientConnected += Server_ClientConnected;
            server.Start();
            
            Console.WriteLine(
                "SCS 服务器启动成功. Press enter to stop...");
            Console.ReadLine();

            server.Stop();
        }

        private static void Server_ClientConnected(object sender, ServiceClientEventArgs e)
        {
            Console.WriteLine("{0} 连接成功",e.Client.ClientId);
        }
    }
}
